package com.zhf.demo01;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

/**
 * @Author: ZhaoHuanfeng
 * @Date: 2020/10/18 16:28
 */
public class HelloTag extends SimpleTagSupport {

    private String name;

    public HelloTag(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public HelloTag() {
    }

    @Override
    public void doTag() throws JspException, IOException {
        //获取输出流
        JspWriter out = this.getJspContext().getOut();
        //写入数据到浏览器
        out.write("自定义标签"+name);
        out.close();
    }
}
